//
//  main.m
//  NB_oc_study
//
//  Created by zhanggang on 2018/6/27.
//  Copyright © 2018 zhang. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Person.h"
#import "Student.h"

void test();

void testArray();

void testDictionary();

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        // insert code here...
//        Person* p = [Person new];
//        [p setAge:22];
//        [p setName:@"hello"];
//        NSLog([p name]);
//
//        Student * student = [Student new];
//        [student setName:@"nj"];
//        NSLog([student getName]);
//
//        [Student sayHi];

//        test();

//        testArray();

        testDictionary();
    }
    return 0;

}

void testDictionary(){
    NSDictionary * nd1 = @{
            @"name":@"hello",
            @"age":@33
    };
    for (NSString *key in nd1) {
        id value = nd1[key];
        NSLog(@"Value: %@ for key: %@", value, key);
    }
}

void testArray(){

    NSArray * arr1 = [[NSArray alloc] initWithObjects:@"a",@2,nil];

    NSArray * arr2 = @[@1,@2,@"abc"];

    NSArray * arr3 = [[NSArray alloc] initWithArray:arr2];

    NSArray * arr4 = [NSArray arrayWithObjects:@"aa",@3,nil];

    for (int i = 0; i < arr4.count; ++i) {
        NSLog(@"%@", arr4[i]);
    }

}

void test(){
    NSLog(@"hello test");
}